

using System;

namespace NodeBasedSkillEditor.Model.Node.RT
{
    public class Node_Sin_RT : RT_Node
    {
        public RT_SingleValuePort Radian_RT;

        public RT_SingleValuePort Sin_RT;

        public Node_Sin_RT(Node_Sin sourceData, RT_DAG parentDag) : base(sourceData, parentDag)
        {
            Radian_RT = new RT_SingleValuePort(EPortIOType.Input, sourceData.Radian, this);

            Sin_RT = new RT_SingleValuePort(EPortIOType.Output, sourceData.Sin, this);
            Sin_RT.OnGetValue = GetSin;

        }

        public AValue GetSin(DAG_Executor executor)
        {
            float radian = Radian_RT.GetValue(executor).ToScalar().Item2;
            float sin = MathF.Sin(radian);
            Sin_RT.SourceValue.SetScalar(sin);
            return Sin_RT.SourceValue;
        }
    }
}